package com.xidian.yunwudemo.controller;

import com.xidian.yunwudemo.common.Result;
import com.xidian.yunwudemo.dto.DataViewBiologyDto;
import com.xidian.yunwudemo.dto.ShowBiologyBarDto;
import com.xidian.yunwudemo.dto.ShowData4G1Dto;
import com.xidian.yunwudemo.dto.ShowDataBiologyDto;
import com.xidian.yunwudemo.entities.PieBasicEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Deprecated
@RestController
@RequestMapping("/serviceShow")
public class ServiceShowController {

    @GetMapping("/adaptiveBarChart")
    public Result getAdaptiveBarChart(){
        String[] timeArray = new String[]{"2021/08/26", "2021/08/27", "2021/08/28", "2021/08/29", "2021/08/30", "2021/08/31", "2021/09/01"};
        Integer[] g4 = new Integer[]{6782, 6783, 7809, 5930, 6289, 6785, 6371};
        Integer[] g5 = new Integer[]{6782, 6783, 7809, 5930, 6289, 6785, 6378};
        Integer[] star = new Integer[]{3223, 3214, 3124, 3124, 3723, 3479, 3890};
        return Result.OK(new ShowData4G1Dto(timeArray,g4,g5,star));
    }

    @GetMapping("/userBarChart")
    public Result getUserBarChart(){
        Integer[][] data = new Integer[][]{
                {320, 332, 301, 334, 390, 330, 320},
                {120, 132, 101, 134, 90, 230, 210},
                {220, 182, 191, 234, 290, 330, 310},
                {150, 232, 201, 154, 190, 330, 410},
                {862, 1018, 964, 1026, 1679, 1600, 1570},
                {620, 732, 701, 734, 1090, 1130, 1120},
                {120, 132, 101, 134, 290, 230, 220}};
        return Result.OK(data);
    }

    @GetMapping("/adaptivePie")
    public Result getAdaptivePie() {
        String[] name = new String[]{"4G","5G","星间"};
        Integer[] value = new Integer[]{12456,31284,3164};
        PieBasicEntity[] pie = new PieBasicEntity[3];
        for (int i = 0; i < 3; i++) {
            pie[i] = new PieBasicEntity(value[i],name[i]);
        }
        return Result.OK(pie);
    }

    @GetMapping("/userPie")
    public Result getUserPie() {
        String[] name = new String[]{"单口令","单短信","动态令牌","uKey","短信+口令","口令+uKey","短信+uKey"};
        Integer[] value = new Integer[]{2145,2145,2145,2145,2145,2145,2145};
        PieBasicEntity[] pie = new PieBasicEntity[7];
        for (int i = 0; i < 7; i++) {
            pie[i] = new PieBasicEntity(value[i],name[i]);
        }
        return Result.OK(pie);

    }

    @GetMapping("/biologyBarChart")
    public Result getBiologyBarChart(){
        String[] timeArray = new String[]{"2021/08/26", "2021/08/27", "2021/08/28", "2021/08/29", "2021/08/30", "2021/08/31", "2021/09/01"};
        Integer[][] data = new Integer[][]{
                {3261, 4327, 5423, 4532, 6578, 3215, 3521},
                {5472, 3213, 3124, 5431, 4321, 3125, 4631}
        };
        return Result.OK(new ShowBiologyBarDto(timeArray,data));
    }

    @GetMapping("/biologyLineChart")
    public Result getBiologyLineChart(){
        String[] timeArray = new String[]{"2021/08/26", "2021/08/27", "2021/08/28", "2021/08/29", "2021/08/30", "2021/08/31", "2021/09/01"};
        String[] face = new String[]{"98", "95", "96", "97", "98", "96", "97"};
        String[] fingerprint = new String[]{"96", "97", "92", "98", "99", "94", "96"};
        return Result.OK(new ShowDataBiologyDto(timeArray,face,fingerprint));
    }
}
